import React from 'react';
import ReactDOM from 'react-dom';
import {Route, BrowserRouter,Switch} from 'react-router-dom';
import Index from './index';
import ComponentList from './components/list';
import ComponentDetails from './components/details';



export default class Root extends React.Component {
	render() {
		return (
			//这里替换了之前的 Index，变成了程序的入口
			<div>
			  <BrowserRouter>
					<Switch>
						<Route exact path="/" component={Index}></Route>
						<Route path="/details" component={ComponentDetails}></Route>
						<Route path="/list/:id" component={ComponentList}></Route>
					</Switch>
			  </BrowserRouter>
	      </div>
		);
	};
}

ReactDOM.render(
	<Root/>, document.getElementById('example')
);
